import request from '@/utils/request'

export function getPermissions() {
  return request({
    url: '/permission/routes',
    method: 'get'
  })
}

export function getRoles() {
  return request({
    url: '/permission/roles',
    method: 'get'
  })
}

export function addRole(data) {
  return request({
    url: '/permission/role/add',
    method: 'post',
    data
  })
}

export function updateRole(id, data) {
  return request({
    url: `/permission/role/update`,
    method: 'post',
    params: { id },
    data
  })
}

export function deleteRole(id) {
  return request({
    url: '/permission/role/delete',
    method: 'get',
    params: { id }
  })
}
